<template>
  <div>
    <Modal
      :value="modalState"
      title="积分商品信息"
      :loading="loading"
      :footer-hide="true"
      @on-cancel="cancel"
      width="35%">
      <div style="margin-left: 120px; font-size: 15px; padding: 20px">
        <div>商品名称：{{row.name}}</div>
        <div style="margin-top: 10px;">商品描述：{{row.des ? row.des : '-'}}</div>
        <div style="display: flex; margin-top: 10px;">
          <div>商品图片：</div>
          <img style="width: 115px; height: 65px;" :src="row.host+row.img" alt="">
        </div>
        <div style="margin-top: 10px;">兑换类型：{{row.type === 1 ? '现金兑换' : '商品兑换'}}</div>
        <div style="margin-top: 10px;">兑换积分：{{row.score}}</div>
        <div style="margin-top: 10px;">{{row.type === 1 ? '兑换金额':'商品原价'}}：{{row.price}}</div>
        <div style="margin-top: 10px;">结束时间：{{row.etime ? this.$moment(row.etime).format('YYYY-MM-DD') : '-'}}</div>
        <div style="display: flex; margin-top: 10px;">
          <div>商品介绍：</div>
          <div ref="productContent"></div>
        </div>
      </div>
    </Modal>
  </div>
</template>
<script>
import {
  mapActions,
  mapState
} from 'vuex'
export default {
  name: 'ViewGoodPointsModal',
  data () {
    return {
      title: '',
      loading: true,
      ruleInline: {
        // name: [
        //   { required: true, message: '姓名不能为空', trigger: 'blur' }
        // ],
        // tel: [
        //   { required: true, message: '手机号不能为空', trigger: 'blur' }
        // ]
      }
    }
  },
  updated () {
    this.title = '积分商品信息'
  },
  computed: {
    ...mapState({
      row: state => state.goodPoints.row,
      modalState: state => state.modal.confirmModalState
    })
  },
  methods: {
    ...mapActions(['updateConfirmModalState']),
    changeLoading () {
      this.loading = false
      this.$nextTick(() => {
        this.loading = true
      })
    },
    cancel () {
      this.updateConfirmModalState(false)
    }
  },
  mounted () {
    // console.log(this.row.content)
    this.$refs.productContent.innerHTML = this.row.content !== '' ? this.row.content : '-'
  }
}
</script>
